import wx


class frame2(wx.Frame):

    def __init__(self):
        wx.Frame.__init__(self, None, -1, "ModelChoose", size=(330, 200), pos=(400, 220))
        panel = wx.Panel(self)

        self.text2=wx.TextCtrl(panel,-1,"",size=(80,50),pos=(50,50))

        self.button2=wx.Button(panel,-1,"OK",size=(80,50),pos=(50,130))







class frame1(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self,None,-1,"Frame 1",size=(250,250),pos=(50,50))
        panel=wx.Panel(self)

        self.text=wx.TextCtrl(panel,-1,size=(80,20),pos=(60,20))

        self.button=wx.Button(panel,-1,"ok",size=(80,40),pos=(60,60))
        self.button.Bind(wx.EVT_BUTTON,self.buttonclick)



    def buttonclick(self,event):
        self.frame2=frame2()
        self.frame2.Show()
        self.frame2.button2.Bind(wx.EVT_BUTTON,self.button2click)

    def button2click(self,event):
        A=self.frame2.text2.GetValue()
        self.text.SetValue(A)
        print(A)
        self.frame2.Close(True)




if __name__ == "__main__":
    app = wx.App()
    frame = frame1()
    frame.Show()
    app.MainLoop()
